import axios from 'axios';
import yz from 'm/comm/yz.js';
import ajax from 'm/ajax/ajaxPost.js';
import Vue from 'vue'
import math from 'mathjs';
var moment = require("moment");



export default {
    data() {
        return {

            id: "fileImage"



        }
    },
    methods: {
        getId() {
            this.id = yz.getId()
        },

        fileChange: function (event) {


            for (var index = 0; index < event.target.files.length; index++) {
                var file = event.target.files[index];
                this.upFile(file)
            }

        },
        upFile(file) {
            var formdata = new FormData();
            formdata.append('file', file);
            formdata.append('action', 'test');
            axios({
                url: '/file',
                method: 'post',
                data: formdata,
                headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
            }).then((res) => {

                this.$emit('callBack', res.data);

            })
        }


    },
    mounted() {
        this.getId();

    },
    props: {



    },
    components: {

    }
}
